import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import commonData from './modules/common'
import planTable from './modules/planTable'
import breadcrumbData from './modules/breadcrumb'
import todoData from './modules/todo'
import taskBookData from './modules/taskBook'
import i18nData from './modules/i18n'
import businessManage from './modules/businessManage'
Vue.use(Vuex)
export default new Vuex.Store({
  modules: {
    commonData,
    planTable,
    breadcrumbData,
    todoData,
    taskBookData,
    i18nData,
    businessManage
  },
  state: {
    loadTable: {
      num: 0,
      tableName: '执行任务'
    },//表头设置点击“确定”，刷新数据
    commitApply: 0,//待办中心--申请完成
    selectedTableData: [],//选中的表格数据
    risk:[],//复制的风险数据数组
    question:[],//复制的问题数据数组
    applyTableData: [],//申请完成表格数据
    oid: "", // 项目id
    agreementStatus: false,
    itemArr: [], //人员数据
    meetingObj: {}, // 会议纪要
  },
  mutations: {
    countAdd(state, name) {
      state.loadTable.num++
      state.loadTable.tableName = name
    },
    commitApplyAdd(state) {
      state.commitApply++
    },
    getSelectedTableData(state, data) {
      state.selectedTableData = data
    },
    getApplyTableData(state, data) {
      state.applyTableData = data
    },
    getOid(state, data){
      state.oid = data
    },
    setAgreementStatus (state, data) {
      state.agreementStatus = data
    },
    setItemArr (state,info) {
      state.itemArr = info
    },
    // 清空选中的表格方法(zj)
    clearSelectedTableData(state){
      state.selectedTableData = []
    },
    // 复制风险方法（zj)
    copyRisk(state,data){
        // console.log(state);
        // console.log(state.risk);
        state.risk = data
    },
    // 复制问题方法（zj)
    copyQuestion(state,data){
        console.log(state);
        console.log(state.question);
        state.question = data
    },
    clearRisk(state){
        state.risk = []
    },
    clearQuestion(state){
        state.question = []
    },
    setMeetingObjData(state, data) {
      state.meetingObj = data
    }
  },
  actions: {},
  getters
})